@model UserUpdateViewModel
@{
    ViewData["Title"] = "编辑用户";
}

<h2>编辑用户</h2>

<form asp-action="Edit">
    <input type="hidden" asp-for="Id" />
    <div asp-validation-summary="ModelOnly" class="text-danger mb-3"></div>
    
    <div class="row">
        <div class="col-md-6 mb-3">
            <label asp-for="Name" class="form-label"></label>
            <input asp-for="Name" class="form-control" />
            <span asp-validation-for="Name" class="text-danger"></span>
        </div>
        
        <div class="col-md-6 mb-3">
            <label asp-for="Phone" class="form-label"></label>
            <input asp-for="Phone" class="form-control" />
            <span asp-validation-for="Phone" class="text-danger"></span>
        </div>
        
        <div class="col-md-6 mb-3">
            <label asp-for="Email" class="form-label"></label>
            <input asp-for="Email" class="form-control" />
            <span asp-validation-for="Email" class="text-danger"></span>
        </div>
        
        <div class="col-md-6 mb-3">
            <label asp-for="Gender" class="form-label"></label>
            <select asp-for="Gender" class="form-select">
                <option value="0">未知</option>
                <option value="1">男</option>
                <option value="2">女</option>
            </select>
            <span asp-validation-for="Gender" class="text-danger"></span>
        </div>
        
        <div class="col-md-6 mb-3">
            <label asp-for="BirthDate" class="form-label"></label>
            <input asp-for="BirthDate" type="date" class="form-control" />
            <span asp-validation-for="BirthDate" class="text-danger"></span>
        </div>
        
        <div class="col-md-6 mb-3">
            <label asp-for="Hometown" class="form-label"></label>
            <input asp-for="Hometown" class="form-control" />
            <span asp-validation-for="Hometown" class="text-danger"></span>
        </div>
    </div>
    
    <div class="mt-4">
        <input type="submit" value="保存" class="btn btn-primary me-2" />
        <a asp-action="Details" asp-route-id="@Model.Id" class="btn btn-info me-2">查看详情</a>
        <a asp-action="Index" class="btn btn-secondary">返回列表</a>
    </div>
</form>

@section Scripts {
    @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}
